﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>title</title>
    <meta content="$homeContent.getURI('favicon.ico')" itemprop="image">
    <link rel="shortcut icon" href="$homeContent.getURI('favicon.ico')" type="image/x-icon"/>
    <link href="/assets/style.css" rel="stylesheet" type="text/css" /> 
    <link href="/assets/wallpaper.css" rel="stylesheet" type="text/css" /> 
    <link href="/assets/miniui/portal/portal.css" rel="stylesheet" type="text/css" />  
            
    <script src="/assets/miniui/boot.js" type="text/javascript"></script>
    <link href="/assets/miniui/miniui/themes/blue/skin.css" rel="stylesheet" type="text/css" />  
           
    <script src="/assets/echarts-2.2.1/build/dist/echarts-all.js" type="text/javascript"></script>
            
    <script src="/assets/js/util/util.js" type="text/javascript"></script>
    <script src="/assets/jcookie/jquery.cookie.js" type="text/javascript"></script>
    <script src="/assets/miniui/portal/Portal.js" type="text/javascript"></script>
    <script src="/assets/zdialog/zDialog.js" type="text/javascript"></script>
    <script src="/assets/zdialog/zDrag.js" type="text/javascript"></script>





@*    <script src="$adminContent.getURI('assets/swfupload/swfupload.js')" type="text/javascript"></script>
    <script src="$adminContent.getURI('assets/Plupload/demo/js/plupload/plupload.full.min.js')"></script>
    <script src="$adminContent.getURI('assets/Plupload/demo/js/qiniu.js')"></script>*@
    <link href="/assets/xtjm.css" rel="stylesheet" type="text/css" />
    <link href="/assets/xtjm_home.css" rel="stylesheet" type="text/css" />
<style>
    .mini-panel-body{
        padding:0px;
    }
    .mini-layout-region-body {
    	overflow:hidden;
    }

    .icon-user-32 {
        background: url(/assets/images/icon/user-32.png) no-repeat;
        width: 32px;
        height: 32px;
    }

    .icon-user-16 {
        background: url(/assets/images/icon/user-16.png) no-repeat;
        width: 16px;
        height: 16px;
    }

    .icon-sys{
        background:url(/assets/images/Order_Large.png) no-repeat;
        width:32px;
        height:32px;
    }

    .icon-userm{
        background:url(/assets/images/Order_Large.png) no-repeat;
        width:32px;
        height:32px;
    }

    .icon-role{
        background:url(/assets/images/Order_Large.png) no-repeat;
        width:32px;
        height:32px;
    }
</style>

</head>

<body>
    <div class="mini-layout" style="width:100%;height:100%;" id="layout">    
    <div class="header  clr" style='overflow:hidden' region="north" height="96" showSplit="false" showHeader="false">       
        <div class="headerlogo clr fl"  >            
            <img src="/assets/images/xtjm/logo_01.jpg"/>
        </div>
        <div class="headeruser clr fr" >
            <div class="headeruser_top" >
                <p><span>欢迎您：$username！</span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="data">
                        今天是  <script>
                                 var weekDayLabels = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
                                 var now = new Date();
                                 var year = now.getFullYear();
                                 var month = now.getMonth() + 1;
                                 var day = now.getDate();
                                 var currentime = year + "年" + month + "月" + day + "日 " + weekDayLabels[now.getDay()];
                                 document.write(currentime)
                        </script>
                    </span></p>
            </div>
            <div class="headeruser_bot fr" >
                <button class="Selected" type="button" id="ledpm">大屏展示</button>
                <button class="Selected" type="button" onclick="showfulltab()">主页全屏</button>
                <button class="Selected" id='witching' type="button">系统配置</button>
                <button class="Selected" id='changePass' type="button">修改密码</button>
                <button class="Selected" id="outLoggin" type="button">退出 </button>
            </div>
        </div>
    </div>
    <div title="south" region="south" showSplit="false" showHeader="false" height="30" class='footer'>
        <div style="line-height:28px;text-align:center;cursor:default">Copyright © 合肥赛为智能有限公司版权所有</div>
    </div>
    <div showHeader="true"  region="west" width="180" maxWidth="380" minWidth="180" allowResize="false" title="系统菜单">
        <div class="mini-splitter" style="width:100%;height:100%;" id="splitter">
            <div size="50%" showCollapseButton="true" style="border-right:0;">
                <div class="mini-fit">
                    <div id="outlookmenu" class="mini-outlookmenu" url="/Home/OutLookMenu" onitemselect="onItemSelect_OutLookMenu" textField="text" idField="id" parentField="pid" iconField="iconCls" borderStyle="border:0"  expandOnLoad="false"></div>
                </div>
            </div>
            <div showCollapseButton="true" visible="false">
                       <div class="mini-toolbar" style="padding:2px;border-top:0;border-left:0;border-right:0;">
                           <span style="padding-left:5px;"> <strong>子菜单</strong>
                           </span>
                       </div>
                       <div class="mini-fit">
                           <ul id="tree" class="mini-tree" style="width:100%;" onnodeselect="nodeSelect_Tree"
            showTreeIcon="true" textField="text" idField="id" parentField="pid" expandOnLoad="true" showTreeLines="false" resultAsTree="false"></ul>
                       </div>
            </div>
        </div>
    </div>
    <div title="center" region="center" style="border:0;">        
        <div id="mainTabs" class="mini-tabs" activeIndex="0" style="width:100%;height:100%;" plain="false" onactivechanged="onTabsActiveChanged" oncloseclick="onTabsCloseClick">
            <div title="我的主页" url="" name="myhome">  
                 
            </div>
        </div>
    </div>
</div>


<ul id="contextMenu" class="mini-contextmenu">
	<li onclick="closeAll()">关闭所有标签页</li>
    <li onclick="closeOther()">关闭其他标签页</li>
    <li onclick="closeRight()">关闭右侧标签页</li>
    <li onclick="closeLeft()">关闭左侧标签页</li>
</ul>

</body>

<script type="text/javascript">
    mini.parse();
    var layout = mini.get("layout");
    var west = layout.getRegion("west");
    var outlookmenu = mini.get("outlookmenu");
    var tree = mini.get("tree");
    var splitter = mini.get("splitter");
    var pane1 = splitter.getPane(1);
    var pane2 = splitter.getPane(2);
    var filterTabId;

    var isOpenRemove = true;
    var outText = '';

    function onItemSelect_OutLookMenu(e) {
        var node = e.item;
        if (node.url == "" || node.url == "isLoad") {
            if (node.url == "isLoad" && tree.loadId == node.id) {
                var findNodes = tree.findNodes(function (searchNode) {
                    if (searchNode.id == node.childrenId) {
                        return true;
                    }
                });
                tree.selectNode(findNodes[0]);
            } else {
                tree.load("adminScreen.do?action=AdminIndexAction&event_submit_doTree=method&pid=" + node.id + "&level=0");
                tree.loadId = node.id;

                //展开子菜单
                west.width = 360;
                pane1.style = "border-right-width: 1px;";
                splitter.updatePane(1, {});
                pane2.visible = true;
                layout.updateRegion("west", {});

                var findFirstNode;
                var allNodes = tree.getList();
                var filterNodes = tree.findNodes(function (node) {
                    if (node.id == filterTabId) {
                        return true;
                    }
                });
                if (filterNodes.length != 0) {
                    findFirstNode = filterNodes[0];
                } else {
                    for (var i = 0; i < allNodes.length; i++) {
                        var findNode = allNodes[i];
                        if (!findFirstNode && tree.getLevel(findNode) == 1) {
                            findFirstNode = findNode;
                            break;
                        }
                    }
                }
                for (var i = 0; i < allNodes.length; i++) {
                    allNodes[i].fromId = node.id;
                }
                if (findFirstNode) {
                    tree.selectNode(findFirstNode);
                }
            }
        } else {
            //隐藏子菜单
            west.width = 180;
            pane1.style = "border-right-width: 0px;";
            splitter.updatePane(1, {});
            pane2.visible = false;
            layout.updateRegion("west", {});

            showTab(node);
        }
    }

    function nodeSelect_Tree(e) {
        var node = e.node;
        if (node.url != "" && node.url != undefined) {
            showTab(node);
        }
    }


    function showTab(node) {

        var tabs = mini.get("mainTabs");
        var id = node.id;
        var tab = tabs.getTab(id);
        if (!tab) {
            tab = {};
            tab.name = id;
            tab.headerCls = "contextmenu_bind";
            tab.title = node.text;
            tab.showCloseButton = true;
            tab.url = "../" + node.url;
            if (node.fromId) {
                tab.fromId = node.fromId;
                tab._nodeid = node.fromId;
            } else {
                tab._nodeid = node.id;
            }
            tabs.addTab(tab);
        }
        tabs.activeTab(tab);
    }

    function onTabsActiveChanged(e) {

        if (isOpenRemove) {

            $(".contextmenu_bind").bind("contextmenu", function (ee) {
                var menu = mini.get("contextMenu");
                menu.showAtPos(ee.pageX, ee.pageY);
                outText = ee.target.outerText;
                return false;
            });

            var tabs = e.sender;
            var tab = tabs.getActiveTab();
            filterTabId = tab.name;
            //如果是首页,则取消主菜单选择
            if (tabs.activeIndex == 0) {
                outlookmenu.selectNode({});
            }
            if (tab.fromId) {
                //展开子菜单
                west.width = 360;
                pane1.style = "border-right-width: 1px;";
                splitter.updatePane(1, {});
                pane2.visible = true;
                layout.updateRegion("west", {});
            } else {
                //隐藏子菜单
                west.width = 180;
                pane1.style = "border-right-width: 0px;";
                splitter.updatePane(1, {});
                pane2.visible = false;
                layout.updateRegion("west", {});
            }
            if (tab && tab._nodeid) {
                var node = outlookmenu.getNode(tab._nodeid);
                if (node.url == '' || node.url == 'isLoad') { // 防止再次加载
                    node.url = 'isLoad';
                    node.childrenId = tab.name;
                }
                if (node) {
                    //防止首次,二次加载
                    var s_node = outlookmenu.getSelected();
                    if (s_node != node) {
                        outlookmenu.selectNode(node);
                    }
                    //子菜单切换联动
                    var t_node = tree.getSelectedNode();
                    if (t_node != null && tab.name != t_node.id) {
                        var findNodes = tree.findNodes(function (searchNode) {
                            if (searchNode.id == tab.name) {
                                return true;
                            }
                        });
                        tree.selectNode(findNodes[0]);
                    }
                }
            }


        }

    }


    function onTabsCloseClick(e) {
        var tabs = mini.get("mainTabs");
        if (tabs.activeIndex == 0) {
            outlookmenu.selectNode({});
        }
    }

    $('#changePass').click(function () {
        mini.open({
            url: "sys/editPassword.htm",
            allowResize: false,       //允许尺寸调节
            title: "修改密码", width: 345, height: 200
        });
    });

    $('#witching').click(function () {
        mini.open({
            url: "sys/wallpaper.htm",
            allowResize: false,       //允许尺寸调节
            title: "系统配置", width: 550, height: 580
        });
    });

    // 退出
    $('#outLoggin').click(function () {
        $.get('$homeLink' + '/login.do?action=LoginAction&event_submit_doLogout=method',
        function () {
            location.href = '$webxLoginLink';
        });
    });

    //显示led 大屏信息
    $('#ledpm').click(function () {

        /*
         var winWidth = 0; 
         var winHeight = 0; 
        //获取窗口宽度 
            if (window.innerWidth) 
                winWidth = window.innerWidth; 
            else if ((document.body) && (document.body.clientWidth)) 
                winWidth = document.body.clientWidth; 
            //获取窗口高度 
            if (window.innerHeight) 
                winHeight = window.innerHeight; 
            else if ((document.body) && (document.body.clientHeight)) 
                winHeight = document.body.clientHeight; 
            //通过深入Document内部对body进行检测，获取窗口大小 
            if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) 
            { 
                winHeight = document.documentElement.clientHeight; 
                winWidth = document.documentElement.clientWidth; 
            }           
                
        mini.open({
            url: "ledpm.htm?buildId=e58133da-adb0-4105-a918-c67161ce2093&time=1",
            allowResize: false,       //允许尺寸调节
            title: "大屏展示", width: winWidth, height: winHeight
        });
*/
        //location.target = "_bank";
        //location.href = "ledpm.htm?buildId=e58133da-adb0-4105-a918-c67161ce2093&time=5";

        window.open("ledpm.htm?buildId=e8ac3a0d-6ee6-48dd-8ae4-d1166b0308c7&time=1", "_blank");
    });

    function closeAll() {

        isOpenRemove = false;

        var tabs = mini.get("mainTabs").getTabs();

        while (tabs.length > 1) {
            var tab = tabs[tabs.length - 1];
            if (tabs.length == 2) {
                isOpenRemove = true;
            }
            if (tab) {
                mini.get("mainTabs").removeTab(tab);
            }

        }
    }

    function closeOther() {

        isOpenRemove = false;
        var tabs = mini.get("mainTabs").getTabs();

        var activeTab = null;
        for (var i = 0; i < tabs.length; i++) {
            var temp = tabs[i];

            if (outText == temp.title) {
                activeTab = temp;
                break;
            }

        }

        var arr = [];
        arr.push(tabs[0]);
        arr.push(activeTab);

        mini.get("mainTabs").removeAll(arr);

        mini.get("mainTabs").activeTab(activeTab);
        isOpenRemove = true;

        $(".contextmenu_bind").bind("contextmenu", function (ee) {
            var menu = mini.get("contextMenu");
            menu.showAtPos(ee.pageX, ee.pageY);
            outText = ee.target.outerText;
            return false;
        });
    }

    function closeRight() {
        isOpenRemove = false;
        var tabs = mini.get("mainTabs").getTabs();

        var activeTab = null;
        for (var i = 0; i < tabs.length; i++) {
            var temp = tabs[i];

            if (outText == temp.title) {
                activeTab = temp;
                break;
            }
        }

        var arr = [];
        for (var i = 0; i < tabs.length; i++) {

            var tab = tabs[i];
            arr.push(tab);
            if (tab.name == activeTab.name) {
                break;
            }
        }

        mini.get("mainTabs").removeAll(arr);

        mini.get("mainTabs").activeTab(activeTab);
        isOpenRemove = true;

        $(".contextmenu_bind").bind("contextmenu", function (ee) {
            var menu = mini.get("contextMenu");
            menu.showAtPos(ee.pageX, ee.pageY);
            outText = ee.target.outerText;
            return false;
        });

    }

    function closeLeft() {
        isOpenRemove = false;
        var tabs = mini.get("mainTabs").getTabs();

        var activeTab = null;

        var index = 0;
        for (var i = 0; i < tabs.length; i++) {
            var temp = tabs[i];

            if (outText == temp.title) {
                activeTab = temp;
                index = i;
                break;
            }
        }

        var arr = [];
        arr.push(tabs[0]);
        arr.push(activeTab);
        for (var i = index + 1; i < tabs.length; i++) {

            var tab = tabs[i];
            arr.push(tab);
        }

        mini.get("mainTabs").removeAll(arr);

        mini.get("mainTabs").activeTab(activeTab);
        isOpenRemove = true;

        $(".contextmenu_bind").bind("contextmenu", function (ee) {
            var menu = mini.get("contextMenu");
            menu.showAtPos(ee.pageX, ee.pageY);
            outText = ee.target.outerText;
            return false;
        });

    }


    //不同浏览器全屏监听事件
    var flag = 0;//是否显示弹出框标识
    var heightValue = 0;
    //创建输出弹出框dialog       
    var diag = new Dialog();
    if ((navigator.userAgent.indexOf('MSIE') >= 0)
        && (navigator.userAgent.indexOf('Opera') < 0)) {//IE
        //忽略监听;IE不支持html5全屏方法
    } else {
        document.addEventListener("fullscreenchange", function () {
            if (flag == 0 && heightValue == 0) {
                flag = 1;
                showDialog();
            } else {
                try {
                    window.parent.window.Dialog.close();
                    diag.close();
                } catch (e) {
                    //当弹出层不存在时关闭会报错,忽略
                }
                exitFullScreen();
                flag = 0;
                heightValue = 0;

            }
        }, false);

        document.addEventListener("mozfullscreenchange", function () {
            if (flag == 0 && heightValue == 0) {
                flag = 1;
                showDialog();
            } else {
                try {
                    window.parent.window.Dialog.close();
                    diag.close();
                } catch (e) {
                    //当弹出层不存在时关闭会报错,忽略
                }
                exitFullScreen();
                flag = 0;
                heightValue = 0;

            }
        }, false);

        document.addEventListener("webkitfullscreenchange", function () {//chrome

            if (flag == 0 && heightValue == 0) {
                flag = 1;
                showDialog();
            } else {
                try {
                    window.parent.window.Dialog.close();
                    diag.close();
                } catch (e) {
                    //当弹出层不存在时关闭会报错,忽略
                }
                exitFullScreen();
                flag = 0;
                heightValue = 0;

            }
        }, false);
        document.addEventListener("msfullscreenchange", function () {
            if (flag == 0 && heightValue == 0) {
                flag = 1;
                showDialog();
            } else {
                try {
                    window.parent.window.Dialog.close();
                    diag.close();
                } catch (e) {
                    //当弹出层不存在时关闭会报错,忽略
                }
                exitFullScreen();
                flag = 0;
                heightValue = 0;

            }
        }, false);
    }


    function showfulltab() {
        if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0)) {//IE
            showDialog();//IE时直接执行调用弹出 
        } else {
            if (flag == 1) {
                showDialog();//全屏时直接执行调用弹出  
            } else {
                fullScreen();//调用全屏方法   
            }
        }
    }
    //弹出我的首页
    function showDialog() {
        var mtabs = mini.get("mainTabs");
        var nowmtabs = mtabs.getTab(0);
        var winWidth = 0;
        var winHeight = 0;

        //获取窗口宽度 
        if (window.innerWidth)
            winWidth = window.innerWidth;
        else if ((document.body) && (document.body.clientWidth))
            winWidth = document.body.clientWidth;
        //获取窗口高度 
        if (window.innerHeight)
            winHeight = window.innerHeight;
        else if ((document.body) && (document.body.clientHeight))
            winHeight = document.body.clientHeight;
        //通过深入Document内部对body进行检测，获取窗口大小 
        if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) {
            winHeight = document.documentElement.clientHeight;
            winWidth = document.documentElement.clientWidth;
        }
        heightValue = winHeight;//将当前窗体调度赋予判定标识,决定是否显示弹出dialog

        diag.Title = nowmtabs.title;
        diag.Width = winWidth;
        diag.Height = winHeight;
        diag.URL = nowmtabs.url;
        diag.MessageTitle = "";
        diag.Message = "";
        diag.Drag = false;//取消拖拽
        diag.show();
    }
    function fullScreen() {//全屏方法
        var docElm = document.documentElement;
        if (docElm.requestFullscreen) {
            docElm.requestFullscreen();
        }
        else if (docElm.mozRequestFullScreen) {
            docElm.mozRequestFullScreen();
        }
        else if (docElm.webkitRequestFullScreen) {
            docElm.webkitRequestFullScreen();
        }
        else if (docElm.msRequestFullscreen) {
            docElm.msRequestFullscreen();
        }
    }
    function exitFullScreen() {//退出全屏方法
        if (document.exitFullscreen) {
            document.exitFullscreen();
        }
        else if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen();
        }
        else if (document.webkitCancelFullScreen) {
            document.webkitCancelFullScreen();
        }
        else if (document.msExitFullscreen) {
            document.msExitFullscreen();
        }
    }

    $(document).keydown(function (event) {
        if (event.keyCode == 27) {
            flag = 0;
            heightValue = 0;
            exitFullScreen();
        }
    });

</script> 


</html>


